<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
        <title></title>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">

         <!--app-->
        <link rel="stylesheet" href="css/fonts/font-awesome.min.css">
        <link rel="stylesheet" href="css/ui-box.css">
        <link rel="stylesheet" href="css/ui-base.css">
        <link rel="stylesheet" href="css/ui-color.css">
        <link rel="stylesheet" href="css/appcan.icon.css">
        <link rel="stylesheet" href="css/appcan.control.css">
        <link rel="stylesheet" href="css_sdk/css/main.css">
        <link rel="stylesheet" href="test_content/css/login.css">
           <!--amazeui-->
        <link rel="stylesheet" href="assets/css/amazeui.min.css">
        <link rel="stylesheet" href="assets/css/app.css">
        <script src="js/jquery-1.8.3.min.js"></script>    
        <style>
            .am-header-default {
                background-color: #eb1111;
            }
            .bc-btn {
                background-color: #eb1111;
            }
            .logo {
                background-image: url('images/logo.png');
            }
            .umhw1 {
                min-height: 9.16em;
                min-width: 13.5em;
            }
            
            .umar-a {
                margin: 1em;
            }
            .bc-head {
                background-color: #eb1111;
            }
            .uinn {
                padding: 0.2em;
                margin: 0;
            }
        </style>
</head>


<body class="um-vp bc-bg" >

       
            
         <div id="header" class="uh bc-text-head ub bc-head">
               <div class="nav-btn" id="nav-left" onclick="javascript:history.go(-1)">
                    <div class="fa fa-angle-left fa-2x"></div>
                </div>
                <h1 class="ut ub-f1 ulev-3 ut-s tx-c" tabindex="0">初始密码修改</h1>
                <div class="nav-btn nav-bt" id="nav-right"></div>
        </div>
            
            
            <div id="content" class="ub-f1 tx-l ub ub-ver c-wh1" style="margin-top:2em">

               
                <div class="ub ub-ver ub-f1 " >
                    <form method="get" action="http://www.appcan.cn">

                         <div class="uba b-gra umar-a uc-a1 c-wh" style=" background-color: white;">
                            <div class="ub ub-ac">
                                <div class="  ub-img umar-l"></div>
                                <div class="ub-f1 uinput uinn">
                                    <input placeholder="新密码" id="new_pwd"  value="" type="password" class="uc-a1">
                                </div>
                            </div>
                        </div>
                        
                         <div class="uba b-gra umar-a uc-a1 c-wh" style=" background-color: white;">
                            <div class="ub ub-ac">
                                <div class="  ub-img umar-l"></div>
                                <div class="ub-f1 uinput uinn">
                                    <input placeholder="密码确认" id="confirm_pwd"  value="" type="password" class="uc-a1">
                                </div>
                            </div>
                        </div>
                       
                       <div class="uin uinn ub" style="margin-top:1em">
                            <div class="ub-f2"></div>
                            <div class="btn ub-f2 ub ub-ac bc-text-head ub-pc bc-btn uc-a1"  id="submit" onclick="click_sub()">
                                提　交
                            </div>
                            <div class="ub-f2"></div>
                        </div>
                        
                        <button type="submit"class="uinvisible"></button>
                    </form>
                </div>
            </div>
          
    <script>
        function click_sub(){
            var user=sessionStorage.getItem("user");
            var new_pwd=$("#new_pwd").val();
            var confirm_pwd=$("#confirm_pwd").val();
//            alert(user);
            if(new_pwd!=""&&confirm_pwd!=""){
                if(new_pwd==confirm_pwd){
                    $.ajax({
                        type: 'POST',
                        url: "http://101.200.158.44:80/CosmeticSunyuxiWebService/services/LoginWebService/pwdUpdate" ,
                        data: {"userID":user,"rPwd":new_pwd},
                        success: function(data){
                            var result=data[0]["Result"];
                            if(result=="1"){
                                localStorage.setItem("username", user);
                                localStorage.setItem("password", new_pwd);
                                alert("修改密码成功！");
                                window.location.href="home.html";
                            }else{
                                alert("修改密码失败！");
                            }
                        },
                        dataType: "json",
                   });                     
                }else{
                    alert("新密码与密码确认不相同！");
                }
            }else{
                if(new_pwd==""){
                    alert("新密码不能为空！");
                }else if(confirm_pwd==""){
                    alert("密码确认不能为空！");
                }
            }
//            window.location.href="home.html";
        }
    </script>

</body>
</html>
